home *** CD-ROM | disk | FTP | other *** search
/ Amiga News 95 / Amiga News 95.iso / dpat / dpat38 / viewer / sources / filesize.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  499 b   |  35 lines

  1. //
  2. //         FileSize
  3. //
  4. // syntaxe : (int) size = FileSize(char *Name_of_File)
  5. // return -1 if file does not exist
  6. // 
  7. //  Rodrigo REYES 1993
  8. //
  9.  
  10. #include "proto/dos.h"
  11. #include "dos/dos.h"
  12. #include "dos/dosextens.h"
  13.  
  14. int FileSize(char *);
  15.  
  16. int FileSize(char *Name)
  17. {
  18.     int taille=-1;
  19.     struct FileLock *loq;
  20.     struct FileInfoBlock bloq;
  21.     
  22.     loq = (struct FileLock*) Lock(Name,-2);
  23.  
  24.     if (loq)
  25.     {
  26.         Examine( (BPTR) loq,&bloq);
  27.         taille = bloq.fib_Size;
  28.  
  29.         UnLock( (BPTR) loq);
  30.     }
  31.     
  32.     return(taille);
  33. }
  34.  
  35.